package com;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.*;

/**
 * @author：wonders
 * @date： 2022/7/5  10:44
 */
@RestController
@RequestMapping("/api")
public class HarController {
    @PostMapping("/sample/sampleInfo")
    public ResponseVo<List<SampleInfoVO>> getSampleInfo(@Validated @RequestBody InPatientNumberFO inPatientNumberFO) {
        System.out.println(inPatientNumberFO);
        SampleInfoVO vo = new SampleInfoVO();
        vo.setDeptName("瑞金医院");
        vo.setCusValue("123456");
        vo.setCreateDate(new Date());
        vo.setStorageLocation("在冰箱东北角");
        vo.setCode("SM123456");
        vo.setStatusName("没过期");
        vo.setSampleResourceName("始祖病毒");
        vo.setSampleResourceCode("001");
        vo.setTypeName("未知");
        vo.setCollectTime(new Date());
        vo.setName("T病毒");
        List<SampleInfoVO> sampleInfoVOS = Arrays.asList(vo);
        ResponseVo responseVo = new ResponseVo();
        responseVo.setData(sampleInfoVOS);
        return responseVo;
    }

    @PostMapping("/sample/resourceAll")
    public ResponseVo<List<SampleResourceVO>> resourceAll() {
        SampleResourceVO sampleResourceVO = new SampleResourceVO();
        sampleResourceVO.setSampleResourceName("始祖病毒");
        sampleResourceVO.setSampleResourceCode("001");
        sampleResourceVO.setDeptName("瑞金医院");
        ResponseVo responseVo = new ResponseVo();
        responseVo.setData(Arrays.asList(sampleResourceVO));
        return responseVo;
    }

    @PostMapping("/sample/batchSampleInfo")
    @ResponseBody
    ResponseVo<Map<String, Integer>> haveSample(@RequestBody HashSet<String> inPatientNumSet) {
        System.out.println(inPatientNumSet);
        HashMap<String, Integer> map = new HashMap<>();
        map.put("00554615", 1);
        map.put("00550169", 0);
        map.put("00552524", 1);
        map.put("456", 0);
        map.put("00553532", 0);
        map.put("00554269", 0);
        map.put("00553284", 1);
        map.put("678686", 0);
        ResponseVo responseVo = new ResponseVo();
        responseVo.setData(map);
        return responseVo;
    }
}
